import {UserEntity} from "./userEntity";
/**
 * Created by Administrator on 2017/6/29.
 */
export class CurrentUserInfo {
    user: UserEntity
    permissionList: string[] = []

    findPermission(name: string) {
        for (let permission of this.permissionList) {
            if (permission == name) {
                return true
            }
        }
        return false
    }


    public isPermissionOfCollectionEdit() {
        return this.findPermission("collection:edit")
    }

    public isPermissionOfFillPlanEdit() {
        return this.findPermission("fillPlan:edit")
    }


    public isPermissionOfUserEdit() {
        return this.findPermission("user:edit")
    }


    public isPermissionOfRoleEdit() {
        return this.findPermission("role:edit")
    }


    public isPermissionOfFillPlanFill() {
        return this.findPermission("fillPlan:fill")
    }

    public isPermissionOfFillPlanCheck() {
        return this.findPermission("fillPlan:check")
    }


    public isPermissionOfDataAnalysisEdit() {
        return this.findPermission("dataAnalysis:edit")
    }

    public isPermissionOfReportEdit() {
        return this.findPermission("report:edit")
    }


}